//package com.zr0726.news.interceptor;
//
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//@Component
//public class LoginInterceptor extends HandlerInterceptorAdapter {
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        if(request.getSession().getAttribute("user") == null){
//            response.sendRedirect("/admin");
//            System.out.println("拦截");
//            return false;
//        }
//        System.out.println("放行");
//        return true;
//    }
//}
